package com.kakarote.hrm.constant;

import com.kakarote.core.common.enums.SystemCodeEnum;
import com.kakarote.core.exception.CrmException;

import java.util.*;

/**
 * @Author 92487
 * @Date 2024/5/13 10:19
 */

public enum HrmJobLevelEnum {

    ONE(1, "集团高管正职","集团高管正职"),
    TWO(2, "集团高管副职","集团高管副职"),
    THREE(3, "集团高管助理","集团高管助理"),
    FOUR(4, "集团副总师","集团副总师"),
    FIVE(5, "集团中层正职","集团中层正职"),
    SIX(6, "集团中层副职","集团中层副职"),
    SEVEN(7, "集团中层助理","集团中层助理"),
    EIGHT(8, "集团员工","集团员工"),
    NINE(9, "一级公司高管正职","一级公司高管正职"),
    TEN(10, "一级公司高管副职","一级公司高管副职"),
    ELEVEN(11, "一级公司高管助理","一级公司高管助理"),
    TWELVE(12, "一级公司副总师","一级公司副总师"),
    THIRTEEN(13, "一级公司中层正职","一级公司中层正职"),
    FOURTEEN(14, "一级公司中层副职","一级公司中层副职"),
    FIFTEEN(15, "一级公司中层助理","一级公司中层助理"),
    SIXTEEN(16, "一级公司员工","一级公司员工"),
    SEVENTEEN(17, "二级公司高管正职","二级公司高管正职"),
    EIGHTEEN(18, "二级公司高管副职","二级公司高管副职"),
    NINETEEN(19, "二级公司高管助理","二级公司高管助理"),
    TWENTY(20, "二级公司中层正职","二级公司中层正职"),
    TWENTY_ONE(21, "二级公司中层副职","二级公司中层副职"),
    TWENTY_TWO(22, "二级公司中层助理","二级公司中层助理"),
    TWENTY_THREE(23, "二级公司员工","二级公司员工"),
    TWENTY_FOUR(24, "三级公司高管正职","三级公司高管正职"),
    TWENTY_FIVE(25, "三级公司高管副职","三级公司高管副职"),
    TWENTY_SIX(26, "三级公司高管助理","三级公司高管助理"),
    TWENTY_SEVEN(27, "三级公司中层正职","三级公司中层正职"),
    TWENTY_EIGHT(28, "三级公司中层副职","三级公司中层副职"),
    TWENTY_NINE(29, "三级公司中层助理","三级公司中层助理"),
    THIRTY(30, "三级公司员工","三级公司员工"),
    THIRTY_ONE(31, "四级公司高管正职","四级公司高管正职"),
    THIRTY_TWO(32, "四级公司高管副职","四级公司高管副职"),
    THIRTY_THREE(33, "四级公司高管助理","四级公司高管助理"),
    THIRTY_FOUR(34, "四级公司中层正职","四级公司中层正职"),
    THIRTY_FIVE(35, "四级公司中层副职","四级公司中层副职"),
    THIRTY_SIX(36, "四级公司中层助理","四级公司中层助理"),
    THIRTY_SEVEN(37, "四级公司员工","四级公司员工");

    HrmJobLevelEnum(Integer level, String name, String value) {
        this.level = level;
        this.name = name;
        this.value = value;
    }

    private final Integer level;
    private final String name;
    private final String value;

    public Integer getLevel() {
        return level;
    }

    public String getName() {
        return name;
    }
    public String getValue() {
        return value;
    }

    public static HrmJobLevelEnum parse(String value) {
        for (HrmJobLevelEnum hrmJobLevelEnum : values()) {
            if (hrmJobLevelEnum.getValue().equals(value)) {
                return hrmJobLevelEnum;
            }
        }
        throw new CrmException(SystemCodeEnum.SYSTEM_NO_VALID);
    }

    /**
     * 获取正处、副处、正科、副科层级
     */
    public static Map<String, Set<String>> getSectionAndDepartmentLevel() {
        HashMap<String, Set<String>> map = new HashMap<>();
        // 正处级
        Set<String> zhengChuLevel = new HashSet<>();
        zhengChuLevel.add(ONE.getName());
        map.put("正处", zhengChuLevel);
        // 副处级
        Set<String> fuChuLevel = new HashSet<>();
        fuChuLevel.add(TWO.getName());
        map.put("副处", fuChuLevel);
        // 正科级
        Set<String> zhengKeLevel = new HashSet<>();
        zhengKeLevel.add(THREE.getName());
        zhengKeLevel.add(FOUR.getName());
        zhengKeLevel.add(FIVE.getName());
        zhengKeLevel.add(NINE.getName());
        map.put("正科", zhengKeLevel);
        // 副科级
        Set<String> fuKeLevel = new HashSet<>();
        fuKeLevel.add(SIX.getName());
        fuKeLevel.add(TEN.getName());
        map.put("副科", fuKeLevel);
        return map;
    }

}
